from pydantic import Field, BaseModel


# ######## user相关 ########
class UserCreateData(BaseModel):
    username: str = Field('', title="用户名", description="用户名", examples=["username"])
    password: str = Field('', title="密码", description="密码", examples=["password"])
    name: str = Field('', title="姓名", description="姓名", examples=["name"])
    superuser: bool = Field(False, title="是否是超级管理员", description="是否是超级管理员")
    login_type: str = Field('local', title="登录类型", description="登录类型")
    roles: list[int] = Field([], title="角色id列表", description="角色id列表", examples=[[1, 2]])


class UserUpdateData(UserCreateData):
    status: str = Field('active', title="数据状态", description="数据状态")


class UserQueryData(UserUpdateData):
    id: int = Field(0, title="用户id", description="用户id", examples=[1])


class AuthData(BaseModel):
    username: str = Field(..., title="用户名", description="用户名", examples=["username"])
    password: str = Field(..., title="密码", description="密码", examples=["password"])
    login_type: str = Field('local', title="登录类型", description="登录类型")
